import java.util.Scanner;

public class Demo4 {
    public static void main(String[] args) {
        int count = 3;
        Scanner scanner = new Scanner(System.in);
        while (count != 0) {
            System.out.println("请输入密码");
            String passWord = scanner.nextLine();
            if (passWord.equals("021122")) {
                System.out.println("登陆成功");
                return;
            } else {
                count--;
                System.out.println("你还有" + count + "次机会");
            }
        }
    }
}
